package com.lagou.myblog.domain;

/**
 * 通用返回对象
 */
public class LqResult {
    private String status;//http返回的是200 但是我哟啊处理异常，把异常也当成正常数据处理
    private String msg;//描述信息
    private Object data;//返回数据

    private LqResult(String status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public static LqResult build() {
        return new LqResult("200", "成功", null);
    }

    public static LqResult build(String msg) {
        return new LqResult("200", msg, null);
    }

    public static LqResult build(Object data) {
        return new LqResult("200", "成功", data);
    }

    public static LqResult build(String msg, Object data) {
        return new LqResult("200", msg, data);
    }

    public static LqResult build(String status, String msg) {
        return new LqResult(status, msg, null);
    }

    public static LqResult build(String status, String msg, Object data) {
        return new LqResult(status, msg, data);
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "LqResult{" +
                "status=" + status +
                ", msg='" + msg + '\'' +
                '}';
    }
}
